<%@ page import="cn.web.lxxf.JdbcUtils" %>
<%@ page import="java.util.List" %>
<%@ page import="cn.web.lxxf.pojo.User" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%
    String sql = "SELECT id,`name`,`disabled` FROM `jk_user`";
    List<User> users = JdbcUtils.selects(sql, User.class);


%>











<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Java实训团队协作简单案例 - 用户列表页面</title>
    <link rel="shortcut icon" href="assets/img/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="assets/vendors/font-awesome-4.7.0/css/font-awesome.min.css" />
    <link rel="stylesheet" href="assets/css/core.css" />
    <link rel="stylesheet" href="assets/css/index.css" />

    <link rel="stylesheet" href="assets/css/user.css" />
</head>

<body>
<jsp:include page="/WEB-INF/tpl/lxxf/header.jsp"/>

    <section class="container">
        <jsp:include page="/WEB-INF/tpl/lxxf/left.jsp"/>
        <div class="main-right">
            <h3>用户列表页面</h3>
            <a href="user-edit.jsp"><i class="fa fa-plus"></i> 新增用户</a>
            <table>
                <col align="left" width="30%" />
                <col align="left" width="20%" />
                <col align="right" width="50%" />
                <thead>
                    <tr>
                        <th>姓名</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>

                    <% for(User u : users){ %>

                    <tr>
                        <td><%= u.getName() %></td>
                        <td><span class="<%= u.getDisabled() ? "enabled":"disabled"%>"><%= u.getDisabled() ?"启用":"禁用" %></span></td>
                        <td>
                            <a href="user-edit.jsp?id=<%= u.getId()%>">编辑</a>
                            <a href="<%= u.getDisabled() ?"/user/lxxfdisable?id=":"/user/lxxfenable?id=" %><%= u.getId()%>"><%= u.getDisabled() ?"禁用":"启用" %></a>
                            <a href="/user/lxxfdelete?id=<%= u.getId()%>"><%= u.getDisabled() ?"":"删除" %></a>
                        </td>
                    </tr>

                    <% } %>



                </tbody>
            </table>
        </div>
    </section>
</body>

</html>